From 4c535b65d9e1da9c0de65117e2a75661bc8e3c94 Mon Sep 17 00:00:00 2001 From: Behnam Esfahbod Date: Thu, 31 Aug 2017 14:01:17 -0700 Subject: [PATCH] [doc/book] Assign langs to more code blocks --- src/doc/book/README.md | 8 ++++---- src/doc/book/src/getting-started/first-steps.md | 2 +- src/doc/book/src/guide/cargo-toml-vs-cargo-lock.md | 1 - src/doc/book/src/guide/creating-a-new-project.md | 2 +- src/doc/book/src/guide/project-layout.md | 1 - src/doc/book/src/reference/build-scripts.md | 6 +++--- src/doc/book/src/reference/crates-io.md | 10 +++++----- src/doc/book/src/reference/environment-variables.md | 4 ++-- src/doc/book/src/reference/manifest.md | 4 ++-- 9 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/doc/book/README.md b/src/doc/book/README.md index af8d04a59..b24da689e 100644 --- a/src/doc/book/README.md +++ b/src/doc/book/README.md @@ -7,7 +7,7 @@ Building the book requires [mdBook]. To get it: [mdBook]: https://github.com/azerupi/mdBook -```bash +```shell $ cargo install mdbook ``` @@ -15,7 +15,7 @@ $ cargo install mdbook To build the book: -```bash +```shell $ mdbook build ``` @@ -23,7 +23,7 @@ The output will be in the `book` subdirectory. To check it out, open it in your web browser. _Firefox:_ -```bash +```shell $ firefox book/index.html # Linux $ open -a "Firefox" book/index.html # OS X $ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell) @@ -31,7 +31,7 @@ $ start firefox.exe .\book\index.html # Windows (Cmd) ``` _Chrome:_ -```bash +```shell $ google-chrome book/index.html # Linux $ open -a "Google Chrome" book/index.html # OS X $ Start-Process "chrome.exe" .\book\index.html # Windows (PowerShell) diff --git a/src/doc/book/src/getting-started/first-steps.md b/src/doc/book/src/getting-started/first-steps.md index 097f3455d..e0f964e80 100644 --- a/src/doc/book/src/getting-started/first-steps.md +++ b/src/doc/book/src/getting-started/first-steps.md @@ -36,7 +36,7 @@ needs to compile your project. Here’s what’s in `src/main.rs`: -``` +```rust fn main() { println!("Hello, world!"); } diff --git a/src/doc/book/src/guide/cargo-toml-vs-cargo-lock.md b/src/doc/book/src/guide/cargo-toml-vs-cargo-lock.md index e373e3869..de3f18cb0 100644 --- a/src/doc/book/src/guide/cargo-toml-vs-cargo-lock.md +++ b/src/doc/book/src/guide/cargo-toml-vs-cargo-lock.md @@ -82,7 +82,6 @@ dependencies = [ name = "rand" version = "0.1.0" source = "git+https://github.com/rust-lang-nursery/rand.git#9f35b8e439eeedd60b9414c58f389bdc6a3284f9" - ``` You can see that there’s a lot more information here, including the exact diff --git a/src/doc/book/src/guide/creating-a-new-project.md b/src/doc/book/src/guide/creating-a-new-project.md index 541fec7f6..3f0c90e3c 100644 --- a/src/doc/book/src/guide/creating-a-new-project.md +++ b/src/doc/book/src/guide/creating-a-new-project.md @@ -39,7 +39,7 @@ needs to compile your project. Here’s what’s in `src/main.rs`: -``` +```rust fn main() { println!("Hello, world!"); } diff --git a/src/doc/book/src/guide/project-layout.md b/src/doc/book/src/guide/project-layout.md index f122e46eb..1850e5efa 100644 --- a/src/doc/book/src/guide/project-layout.md +++ b/src/doc/book/src/guide/project-layout.md @@ -118,7 +118,6 @@ dependencies = [ name = "rand" version = "0.1.0" source = "git+https://github.com/rust-lang-nursery/rand.git#9f35b8e439eeedd60b9414c58f389bdc6a3284f9" - ``` You can see that there’s a lot more information here, including the exact diff --git a/src/doc/book/src/reference/build-scripts.md b/src/doc/book/src/reference/build-scripts.md index eb5bb0d21..2c6fe3d81 100644 --- a/src/doc/book/src/reference/build-scripts.md +++ b/src/doc/book/src/reference/build-scripts.md @@ -49,7 +49,7 @@ All the lines printed to stdout by a build script are written to a file like configuration). Any line that starts with `cargo:` is interpreted directly by Cargo. This line must be of the form `cargo:key=value`, like the examples below: -```notrust +```shell # specially recognized by Cargo cargo:rustc-link-lib=static=foo cargo:rustc-link-search=native=/path/to/foo @@ -212,7 +212,7 @@ library call as part of the build script. First, let’s take a look at the directory structure of this package: -```notrust +```shell . ├── Cargo.toml ├── build.rs @@ -298,7 +298,7 @@ a Rust library which calls into C to print “Hello, World!”. Like above, let’s first take a look at the project layout: -```notrust +```shell . ├── Cargo.toml ├── build.rs diff --git a/src/doc/book/src/reference/crates-io.md b/src/doc/book/src/reference/crates-io.md index f1a76ddfa..76a36a103 100644 --- a/src/doc/book/src/reference/crates-io.md +++ b/src/doc/book/src/reference/crates-io.md @@ -16,7 +16,7 @@ account (required for now). After this, visit your [Account Settings](https://crates.io/me) page and run the `cargo login` command specified. -```notrust +```shell $ cargo login abcdefghijklmnopqrstuvwxyz012345 ``` @@ -37,7 +37,7 @@ The next step is to package up your crate into a format that can be uploaded to our entire crate and package it all up into a `*.crate` file in the `target/package` directory. -```notrust +```shell $ cargo package ``` @@ -87,7 +87,7 @@ Now that we’ve got a `*.crate` file ready to go, it can be uploaded to [crates.io] with the `cargo publish` command. And that’s it, you’ve now published your first crate! -```notrust +```shell $ cargo publish ``` @@ -119,7 +119,7 @@ being broken for one reason or another (syntax error, forgot to include a file, etc.). For situations such as this, Cargo supports a “yank” of a version of a crate. -```notrust +```shell $ cargo yank --vers 1.0.1 $ cargo yank --vers 1.0.1 --undo ``` @@ -142,7 +142,7 @@ A crate is often developed by more than one person, or the primary maintainer may change over time! The owner of a crate is the only person allowed to publish new versions of the crate, but an owner may designate additional owners. -```notrust +```shell $ cargo owner --add my-buddy $ cargo owner --remove my-buddy $ cargo owner --add github:rust-lang:owners diff --git a/src/doc/book/src/reference/environment-variables.md b/src/doc/book/src/reference/environment-variables.md index 7abebd0f7..e95b79d6c 100644 --- a/src/doc/book/src/reference/environment-variables.md +++ b/src/doc/book/src/reference/environment-variables.md @@ -40,7 +40,7 @@ Cargo exposes these environment variables to your crate when it is compiled. Note that this applies for test binaries as well. To get the value of any of these variables in a Rust program, do this: -``` +```rust let version = env!("CARGO_PKG_VERSION"); ``` @@ -66,7 +66,7 @@ Cargo sets several environment variables when build scripts are run. Because the are not yet set when the build script is compiled, the above example using `env!` won't work and instead you'll need to retrieve the values when the build script is run: -``` +```rust use std::env; let out_dir = env::var("OUT_DIR").unwrap(); ``` diff --git a/src/doc/book/src/reference/manifest.md b/src/doc/book/src/reference/manifest.md index a87b7fd53..8b71819c0 100644 --- a/src/doc/book/src/reference/manifest.md +++ b/src/doc/book/src/reference/manifest.md @@ -417,7 +417,7 @@ features that people can enable or disable when they build it. In that case, Servo will describe features in its `Cargo.toml` and they can be enabled using command-line flags: -``` +```shell $ cargo build --release --features "shumway pdf" ``` @@ -535,7 +535,7 @@ Your project can optionally contain folders named `examples`, `tests`, and `benches`, which Cargo will treat as containing examples, integration tests, and benchmarks respectively. -```notrust +```shell ▾ src/ # directory containing source files lib.rs # the main entry point for libraries and packages main.rs # the main entry point for projects producing executables -- 2.30.2